import com.itheima.config.JDBCConfig;
import com.itheima.config.MyBatisConfig;
import com.itheima.config.SpringConfig;
import com.itheima.domain.Account;
import com.itheima.service.AccountService;
import com.itheima.service.impl.AccountServiceImpl;
import org.mybatis.spring.batch.MyBatisBatchItemWriter;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.List;

public class App {
    public static void main(String[] args) {
        /*ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
        AccountService accountService = (AccountService) ctx.getBean("accountService");
        Account ac = accountService.findById(2);
        System.out.println(ac);*/
        AnnotationConfigApplicationContext an=new AnnotationConfigApplicationContext(SpringConfig.class);
        AccountService accountService = (AccountService)an.getBean("accountService");
        List<Account> all = accountService.findAll();
        System.out.println(all.toString());
        Account byId = accountService.findById(1);
        System.out.println("======================");
        System.out.println(byId);
    }
}
